{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c6a98b2c-2729-43e9-9066-d01f48ed96e0",
   "metadata": {},
   "source": [
    "Chapter 03\n",
    "\n",
    "# 用热图可视化矩阵乘法第三视角\n",
    "《线性代数》 | 鸢尾花书：数学不难"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1e8ec2c7-8379-4bf6-a9a8-ffd5f7930a48",
   "metadata": {},
   "source": [
    "这段代码的主要目的是进行随机矩阵的生成、矩阵乘法运算，并通过热力图（heatmap）进行可视化展示。我们将从数学角度详细分析代码的操作过程，并提供相关的数学公式。\n",
    "\n",
    "---\n",
    "\n",
    "### **1. 矩阵初始化**\n",
    "代码首先导入 `numpy` 进行数值计算，`seaborn` 用于可视化矩阵，`matplotlib.pyplot` 用于绘图。\n",
    "\n",
    "定义矩阵 $A$ 和 $B$：\n",
    "- $A$ 是一个 $5 \\times 12$ 维的随机矩阵，元素从均匀分布 $U(-1,1)$ 采样：\n",
    "  $$\n",
    "  A = \\begin{bmatrix} a_{11} & a_{12} & \\cdots & a_{1,12} \\\\ a_{21} & a_{22} & \\cdots & a_{2,12} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ a_{51} & a_{52} & \\cdots & a_{5,12} \\end{bmatrix}, \\quad a_{ij} \\sim U(-1,1)\n",
    "  $$\n",
    "- $B$ 是一个 $12 \\times 8$ 维的随机矩阵，元素同样从 $U(-1,1)$ 采样：\n",
    "  $$\n",
    "  B = \\begin{bmatrix} b_{11} & b_{12} & \\cdots & b_{1,8} \\\\ b_{21} & b_{22} & \\cdots & b_{2,8} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ b_{12,1} & b_{12,2} & \\cdots & b_{12,8} \\end{bmatrix}, \\quad b_{ij} \\sim U(-1,1)\n",
    "  $$\n",
    "\n",
    "随后，使用 `seaborn.heatmap()` 可视化 $A$ 和 $B$，热力图能够直观地显示矩阵中各元素的数值分布。\n",
    "\n",
    "---\n",
    "\n",
    "### **2. 计算矩阵乘法 $C = A B$**\n",
    "矩阵乘法的定义：\n",
    "$$\n",
    "C = A B\n",
    "$$\n",
    "其中：\n",
    "- $A$ 的形状为 $(5,12)$\n",
    "- $B$ 的形状为 $(12,8)$\n",
    "- 结果 $C$ 的形状为 $(5,8)$\n",
    "\n",
    "矩阵 $C$ 的元素计算如下：\n",
    "$$\n",
    "c_{ij} = \\sum_{k=1}^{12} a_{ik} b_{kj}\n",
    "$$\n",
    "即：\n",
    "$$\n",
    "C = \\begin{bmatrix} c_{11} & c_{12} & \\cdots & c_{18} \\\\ c_{21} & c_{22} & \\cdots & c_{28} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ c_{51} & c_{52} & \\cdots & c_{58} \\end{bmatrix}\n",
    "$$\n",
    "其中：\n",
    "$$\n",
    "c_{ij} = a_{i1} b_{1j} + a_{i2} b_{2j} + \\dots + a_{i,12} b_{12,j}\n",
    "$$\n",
    "\n",
    "---\n",
    "\n",
    "### **3. 矩阵 $C$ 的可视化**\n",
    "代码计算 $C$ 的最大值和最小值：\n",
    "```python\n",
    "C.max()\n",
    "C.min()\n",
    "```\n",
    "然后，使用 `seaborn.heatmap()` 绘制 $C$ 的热力图，并通过 `vmin=C.min(), vmax=C.max()` 设置颜色范围，使颜色映射能直观地体现数值的相对大小。\n",
    "\n",
    "接着，代码通过 `plt.subplots()` 组合可视化：\n",
    "- `C` 的热力图\n",
    "- `A` 的热力图\n",
    "- `B` 的热力图\n",
    "- 以及符号 \"=\" 和 \"@\" 用于直观表示矩阵乘法 $C = A B$\n",
    "\n",
    "---\n",
    "\n",
    "### **4. 按列计算 $C$ 的每一列**\n",
    "由于 $C$ 由 $A$ 和 $B$ 的列向量计算得到，我们可以将其按列拆分，逐列计算：\n",
    "$$\n",
    "C_j = A \\cdot B_{[:, j]}\n",
    "$$\n",
    "其中 $B_{[:, j]}$ 代表矩阵 $B$ 的第 $j$ 列，形状为 $(12,1)$，所以矩阵乘法 $A B_{[:, j]}$ 产生一个 $(5,1)$ 形状的列向量：\n",
    "$$\n",
    "c_j = \\begin{bmatrix} c_{1j} \\\\ c_{2j} \\\\ c_{3j} \\\\ c_{4j} \\\\ c_{5j} \\end{bmatrix}\n",
    "$$\n",
    "即：\n",
    "$$\n",
    "c_j = A \\cdot \\begin{bmatrix} b_{1j} \\\\ b_{2j} \\\\ \\vdots \\\\ b_{12,j} \\end{bmatrix} = \\begin{bmatrix} \\sum_{k=1}^{12} a_{1k} b_{kj} \\\\ \\sum_{k=1}^{12} a_{2k} b_{kj} \\\\ \\vdots \\\\ \\sum_{k=1}^{12} a_{5k} b_{kj} \\end{bmatrix}\n",
    "$$\n",
    "\n",
    "代码使用 `plt.subplots()` 生成多个子图，并在循环 `for j in range(n):` 中计算 $C_j$ 并绘制热力图，直观展示矩阵乘法如何通过 $B$ 的列向量逐列计算得到 $C$。\n",
    "\n",
    "---\n",
    "\n",
    "### **5. 结论**\n",
    "这段代码通过：\n",
    "1. **随机生成矩阵 $A$ 和 $B$**，并可视化它们的数值分布。\n",
    "2. **计算矩阵乘法 $C = A B$**，并解析矩阵乘法的计算过程。\n",
    "3. **绘制 $C$ 的热力图**，与 $A$ 和 $B$ 进行对比，直观展示矩阵乘法的结果。\n",
    "4. **逐列计算 $C$**，解释矩阵乘法如何通过列向量形式拆解进行计算。\n",
    "\n",
    "矩阵 $C$ 的结构反映了 $A$ 的行向量与 $B$ 的列向量的线性组合，这种计算方式在信号处理、深度学习（如全连接层的计算）、数据压缩（如奇异值分解 SVD）、物理模拟等领域广泛应用。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ece0de0f-22f5-4e81-b7a1-52ba9c655323",
   "metadata": {},
   "source": [
    "## 初始化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e7785bcb-527f-4d48-bfd6-f96aa060144c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np  # 导入数值计算库\n",
    "import seaborn as sns  # 导入数据可视化库\n",
    "from matplotlib import pyplot as plt  # 导入绘图库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6a508235-6982-4cb3-98ea-5cb1cdf7dd41",
   "metadata": {},
   "source": [
    "## 创建矩阵A和B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d54c24ce-a341-4258-bb2e-495012d34e83",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.2951021 ,  0.01429938,  0.05668276,  0.79257041,  0.39998238,\n",
       "         0.4285942 ,  0.43467676, -0.55436108, -0.64969095, -0.08631702,\n",
       "         0.85747686, -0.98022823],\n",
       "       [-0.82015561,  0.70040054, -0.02875788,  0.75367118, -0.38533212,\n",
       "        -0.22406891,  0.16289149, -0.77262564,  0.53576037, -0.37486792,\n",
       "         0.29202092, -0.93460217],\n",
       "       [-0.66720885, -0.13939394, -0.54438706,  0.93261493,  0.80987882,\n",
       "         0.73132583, -0.93567444,  0.5989955 ,  0.81231102,  0.40786666,\n",
       "        -0.54057511, -0.1771288 ],\n",
       "       [ 0.95728792, -0.34190808,  0.19105814,  0.07169268, -0.07780809,\n",
       "        -0.54840068,  0.84110593,  0.22164568, -0.55981616, -0.9214308 ,\n",
       "         0.09577916, -0.81962657],\n",
       "       [ 0.63613656,  0.36713916,  0.87165598, -0.82017787, -0.97328478,\n",
       "        -0.56777511, -0.23258517,  0.47506735, -0.48989147, -0.48920298,\n",
       "        -0.52213956, -0.78695798]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.random.seed(88)  # 保证每次运行生成相同的随机数\n",
    "A = np.random.uniform(-1, 1, (5, 12))\n",
    "# 生成一个 5×12 的随机整数矩阵（数值范围 0~10）\n",
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c67d8ec4-5bb6-4d83-9e05-d35990ea25c3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output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itRVFSkpUuX6pZbbrGdclk9e/bUV199VXcrLS21neTj22+/1cCBAxUVFaWNGzfqs88+07PPPqs2bdrYTqtTVFTk83tYWFgoSbrvvvssl/n605/+pJdeekmLFi1SeXm5nn76aT3zzDNauHCh7TQfU6ZMUWFhoV577TWVlpYqPT1dI0aM0BdffGGlp6HH7qeffloLFizQokWLVFRUpLi4OI0cOVKnT58Oqc7q6moNHDhQBQUF/39RTpi57bbbnKysLJ9jSUlJzsyZMy0VBSbJefPNN21nNKiiosKR5OzYscN2SkA/+9nPnGXLltnOqOf06dNOjx49nMLCQmfo0KHO1KlTbSf5yMvLc/r06WM7I6AZM2Y4gwYNsp0RlKlTpzrdu3d3amtrbaf4GDVqlJOZmelz7J577nEmTZpkqai+M2fOOBEREc4777zjc7xPnz7OrFmzLFX94P8+dtfW1jpxcXFOQUFB3bFz5845rVu3dl566SULhRcFeh9z5MgRR5Kzb98+4x1hdWXj/PnzKi4uVnp6us/x9PR07d6921JVeKisrJQkXXvttZZLLq+mpkarV69WdXW1UlNTbefUk52drVGjRmnEiBG2U/w6ePCgEhIS1LVrV40fP16HDx+2neRjw4YNSklJ0X333af27durX79+euWVV2xn+XX+/Hm9/vrryszMlMvlsp3jY9CgQXr33Xd14MABSdJf//pX7dq1S7/4xS8sl/3gwoULqqmpUYsWLXyOR0dHa9euXZaq/Dty5IhOnDjh8/7H7XZr6NChvP+RFGk7oDF98803qqmpUYcOHXyOd+jQQSdOnLBU1fQ5jqPc3FwNGjRIvXr1sp3jo7S0VKmpqTp37pyuueYavfnmm7r55pttZ/lYvXq19u7da/VzzQ25/fbbtXLlSt100036+9//rqeeekppaWkqKytT27ZtbedJkg4fPqwlS5YoNzdXTzzxhD7++GP97ne/k9vt1oMPPmg7r57169fr1KlTeuihh2yn1DNjxgxVVlYqKSlJERERqqmp0bx58zRhwgTbaXVatWql1NRU/fGPf1RycrI6dOigN954Qx999JF69OhhO6+eS+9jLvf+5+jRozaSQkpYjY1L/u9HEY7jhNxHFk3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T0GN3Tk6O5s+frx49eqhHjx6aP3++WrZsqYkTJ4ZU58mTJ3Xs2DF9+eWXklQ34uPi4sx9fR3jr3exYPHixU6XLl2c5s2bO/379w+5l2tu377dkVTvNnnyZNtpdS7XJ8lZvny57bQ6mZmZdf+fr7vuOmf48OHOli1bbGc1KBRf+jpu3DgnPj7eiYqKchISEpx77rnHKSsrs51Vz9tvv+306tXLcbvdTlJSkrN06VLbSfVs3rzZkeTs37/fdopfVVVVztSpU53OnTs7LVq0cLp16+bMmjXL8Xq9ttN8rFmzxunWrZvTvHlzJy4uzsnOznZOnTplraehx+7a2lonLy/PiYuLc9xutzNkyBCntLQ05DqXL19+2fvz8vKMNfFPzAMAAKPC6jkbAAAg9DA2AACAUYwNAABgFGMDAAAYxdgAAABGMTYAAIBRjA0AAGAUYwMAABjF2AAAAEYxNgAAgFGMDQAAYBRjAwAAGPW/Q2ATLlF190AAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(A, cmap = 'RdYlBu_r', square = True, \n",
    "            cbar = False,\n",
    "            linecolor = 'w', linewidths = 0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f5f12b9b-36f5-49a6-a1d8-4bdf9b956704",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.63544881,  0.78586467, -0.8805252 , -0.66807296, -0.92597501,\n",
       "         0.40170689,  0.99329933, -0.77794562],\n",
       "       [ 0.44911418, -0.32517321, -0.6463447 ,  0.88373575,  0.95186898,\n",
       "         0.52953172, -0.19490997, -0.16397646],\n",
       "       [ 0.28995495, -0.92863205, -0.73063709,  0.26954949,  0.86110223,\n",
       "         0.90084512,  0.12667943, -0.57593776],\n",
       "       [ 0.0818441 , -0.65333352, -0.70500183,  0.45299007, -0.58046341,\n",
       "        -0.95581985,  0.25193687,  0.90186504],\n",
       "       [ 0.78719916, -0.26147268,  0.85737295,  0.02976143,  0.88742041,\n",
       "         0.13894219, -0.97340213, -0.32344632],\n",
       "       [-0.76270929, -0.31874168, -0.27196198,  0.30947122,  0.87200487,\n",
       "        -0.60105042,  0.24760211, -0.68565583],\n",
       "       [-0.8348775 ,  0.38619428, -0.45257766, -0.19015451,  0.99434971,\n",
       "         0.0082224 ,  0.87605771, -0.28638224],\n",
       "       [-0.40400711, -0.7689096 , -0.09600042,  0.95586342, -0.06598517,\n",
       "        -0.93511531,  0.31161634, -0.94289277],\n",
       "       [-0.39658628,  0.95619366, -0.84529541, -0.31177212, -0.99557658,\n",
       "         0.37476923, -0.93195442, -0.44681321],\n",
       "       [-0.9639589 , -0.8175903 ,  0.91542455,  0.77615542,  0.31394815,\n",
       "         0.95950185, -0.07857369, -0.84930187],\n",
       "       [ 0.60937844,  0.27349324,  0.4083768 ,  0.94846395,  0.3103788 ,\n",
       "         0.35963455, -0.32960103,  0.59283227],\n",
       "       [-0.38290982, -0.99518425,  0.94131515, -0.45964301,  0.73569824,\n",
       "        -0.02837254,  0.83754994,  0.21442016]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B =  np.random.uniform(-1, 1, (12, 8))\n",
    "# 生成一个 5×12 的随机整数矩阵（数值范围 0~10）\n",
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0a566b18-2699-4803-8cbb-cf67866fd0b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASIAAAGdCAYAAAC2In4WAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAfbUlE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+dSlSxc999xzQc/dtm2bDh8+rLi4ONWoUUM1atTQunXr9Kc//Uk1atRQUVFR0Gf4XmRkpDp37qycnJyg5kRHR19Q8B06dAj6L2J+6IsvvtB7772n++67L+hZVbaIatasqbi4uJJX9L+3evVqXXvttYamCi7btvXQQw/prbfe0gcffKDWrVsbn8eNuwb27dtXO3fu1Pbt20u2+Ph4DRs2TNu3b1f16tWDPsP3/H6/9uzZo+jo6KDm9OrV64K3Zuzdu1etWrUKau4PzZ8/X02aNNHNN98c/LCgvQzugsWLF9sRERH2K6+8Yu/evdseO3asHRkZaX/++edBzT158qSdlZVlZ2Vl2ZLsZ555xs7KyrK/+OKLoOY+8MADdlRUlL127Vo7Ly+vZPv222+Dmmvbtu31eu3169fb+/fvt3fs2GFPnDjRrlatmr1q1aqgZ1+MW781++1vf2uvXbvWzs3NtTdt2mTfcsstdr169YL+f+zjjz+2a9SoYU+bNs3OycmxX331VbtOnTr2okWLgpr7vaKiIjsmJsZOT093Ja9KF5Ft2/aLL75ot2rVyq5Zs6bdvXt3V36VvWbNGlvSBdvw4cODmnuxTEn2/Pnzg5pr27adkpJS8u982WWX2X379jVWQrbtXhHddddddnR0tB0REWE3b97cHjRokL1r166g59q2bb/zzjt2p06dbMuy7NjYWPvll192Jde2bXvlypW2JDs7O9uVPG4DAsC4KvsaEYDQQREBMI4iAmAcRQTAOIoIgHEUEQDjKCIAxlFEAIyjiAAYRxEBMI4iAmAcRQTAuP8Dj3Q7/MnUun0AAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(B, cmap = 'RdYlBu_r', square = True, \n",
    "            cbar = False,\n",
    "            linecolor = 'w', linewidths = 0.25)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dfeed245-4e33-4910-9833-2137fd34faa3",
   "metadata": {},
   "source": [
    "## 矩阵乘法 A@B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7d3b567f-da0f-4c6a-897f-f95eacf02cba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.98797093,  0.66910163, -0.88876459,  1.12118591,  0.69130305,\n",
       "        -0.25055795, -0.06932378,  1.08696502],\n",
       "       [ 1.61749156,  1.31993114, -2.06638394,  0.89880038, -0.60852435,\n",
       "         0.072751  , -1.89227367,  2.23129511],\n",
       "       [-0.07813197, -1.37788175,  0.57851779,  1.23120289, -1.1172428 ,\n",
       "        -2.11212281, -2.4691439 , -0.4314863 ],\n",
       "       [ 0.34710126,  2.04869843, -2.23427683, -1.05088561, -1.11971085,\n",
       "        -0.61067229,  1.68173533,  0.13102407],\n",
       "       [ 0.2644065 ,  0.65919255, -2.46419918, -0.30393328, -1.04122842,\n",
       "         0.96055876,  1.22317478, -1.31792664]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C = A @ B\n",
    "C"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "249154c9-d3e6-4b7d-8c07-5df88d0aff1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.23129510882643"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C.max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a0bcbf9c-920a-492b-b5af-0f6d224a9316",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-2.4691438978737184"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C.min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "85fe8fe6-0b22-45c8-aecf-666084b060ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 1.0, 'B')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAEPCAYAAADSw3WzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAg30lEQVR4nO3deXzU1f3v8fd3liTsvygEUQTiQtAGLCQEQq0IXBZFq7gghVIEpAhiBRd+2N/lUustBYv117qwFRDrwq1AtKCItGy2RJYWi8iFuICCllW2smWW8/tjmEAkE75fJBmS83o+HnlM8p1zcj4DOd+8c2bmfB1jjBEAAACs4Ut2AQAAAKhcBEAAAADLEAABAAAsQwAEAACwDAEQAADAMgRAAAAAyxAAAQAALEMABAAAsAwBEAAAwDIEQAAAAMsQAAEAVgiHw3rppZfUs2dPZWRkKBAIqGHDhurWrZteeuklRSKRZJeICvTiiy/KcZxSHw0aNNCNN96ohQsXJru8SkcABABUex9++KFatmypkSNHqkWLFvrtb3+r5cuXa+bMmWrXrp3Gjh2rdu3a6dNPP012qahgs2bNUmFhoVatWqVp06bJ7/fr1ltv1YIFC5JdWqVyjDEm2UUAAFBRPvroI3Xo0EF9+/bVpEmTVKtWrTPaHDt2TKNGjdKiRYu0atUqXXbZZUmoFBXpxRdf1MCBA7V27Vrl5uaWHD927JjS09N1xx136NVXX01ihZWLFUBYwxijcDjs6gNA9RCJRNS7d28NHjxYkydPLjP8GWOUkpKiKVOmqGPHjrr//vuTUCmSJS0tTSkpKQoGg8kupVIRAGGNFStWKBgMuvrYtm1bsssFcB7MmTNHR44c0YQJEyRJ0WhUv/jFL3TZZZepRo0auvPOOzVp0iR16dJFkvTMM8/oz3/+sz755JNklo0KFIlEFA6HFQqFtGPHDo0cOVJHjhxR3759k11apQokuwCgsuTk5Gjt2rWu2l566aUVXA2AyvDGG2/o3nvvVUpKiiTpueee01NPPaXx48erZcuWKigo0NixY9W+fXtJ0sUXX6z8/HwtW7ZMV111V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SIn8b7Wks//eekiStbJzlus8NO7ZIkh5+/QPXfX5z93clSdGNv3TdR5J82f8lSfrxs++57vPSg993//09VQMAAIAqjwAIAABgGQIgAACAZQiAAAAAliEAAgAAWMbaALhhwwYNHDhQmZmZSktLU+3atdWmTRs99dRT+vrrr5NdHgAAQIWxchuY6dOna/jw4crKytJjjz2ma6+9VqFQSOvWrdOUKVNUWFiogoKCZJcJAABQIawLgIWFhRo2bJi6du2qN954Q6mpqSX3de3aVY888ojeecf9XkcAAABVjXVPAY8fP16O42jatGmlwl9cSkqKfvCDHyShMgAAgMphVQCMRCJaunSpcnJydPnllye7HAAAgKSwKgDu3btXR48eVWZmZrJLAQAASBrHGGOSXURl2bVrly655BL16dNHr732WrLLAQCgSnAcJ9klwCW3sc6qFcD69eurZs2a2rp1a7JLAQAASBqr3gXs9/vVpUsXLVq0SDt27FDjxo2TXRIAAFVCp6HzXLddNvVOSVLkzfs8jeG/7feSpOnrvnDdZ0huE0nS54ePehqraZ2akqRX1Nx1n34qkiSZyJ9d93H8/0uStLJxlofqpBt2bJEkrd55yHWfdpfUdd3WqhVASXr88cdljNGQIUNUXFx8xv2hUEgLFixIQmUAAACVw6oVQEnKz8/X5MmTNXz4cOXk5GjYsGH6zne+o1AopPXr12vatGnKzs7WrbfemuxSAQAAKoR1AVCShgwZory8PD3zzDOaOHGidu7cqWAwqObNm6tv374aMWJEsksEAACoMFYGQEm67rrr9OKLLya7DAAAgEpn3WsAAQAAbEcABAAAsAwBEAAAwDIEQAAAAMsQAAEAACxDAAQAALCMY9xeNRgAAFjJcZxklwCX3MY61/sA8p9fdZDpAQBAeTxtBF38Qm/XbVOG/1GSFFk2ylNB/k7PSJKWbd/vuk+ny9MlScf+7w9c96nxv/8kSYosedBDdZK/67OSpKOhD1z3qRn8riTJhN/1NJYT6CZJOj7xdtd90v7zDU9jAADgxh8373LdtneLhpKknmPf8TTGW0/2kCQdOPGx6z7/kXq1JGleWnNPY915vEiSdCS0wXWfWsFWkqS87jNd91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rRpc0FvqZLo33TWrFnJLg04J/v27TP9+vUzderUMXXq1DH9+vU7Y3uE03/Gjx49arp162YaNGhggsGgadKkiRkwYID54osvzvje5c3tAQMGmI4dO5Zqv3z5ctO6dWuTkpJimjVrZiZPnuzpsXgZb+LEiebKK680aWlpJj093Vx//fXmrbfe8jQeUNVVl/lfFee+Y8zJVzkCAADAChfWi/IAAABQ4QiAAAAAliEAAgAAWIYACAAAYBkCIAAAgGUIgAAAAJYhAAIAAFiGAAgAAGAZAiAAAIBlCIAAAACWIQACAABYhgAIAABgGQIgAACAZQiAAAAAliEAAgAAWIYACAAAYBkCIAAAgGX+B/cnOgnJrA/2AAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 800x300 with 8 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, axs = plt.subplots(1, 5, figsize=(8, 3))  \n",
    "\n",
    "plt.sca(axs[0])\n",
    "ax = sns.heatmap(C, cmap='RdYlBu_r', \n",
    "                 linecolor = 'k', linewidths = '0.25',\n",
    "                 vmin = C.min(), vmax = C.max(),\n",
    "                 xticklabels = [], yticklabels = [],\n",
    "                 cbar_kws={\"orientation\": \"horizontal\"})\n",
    "ax.set_aspect(\"equal\")\n",
    "plt.title('C')\n",
    "\n",
    "plt.sca(axs[1])\n",
    "plt.title('=')  # 绘制等号\n",
    "plt.axis('off')\n",
    "\n",
    "plt.sca(axs[2])\n",
    "ax = sns.heatmap(A, cmap='RdYlBu_r', \n",
    "                 linecolor = 'k', linewidths = '0.25',\n",
    "                 xticklabels = [], yticklabels = [],\n",
    "                 cbar_kws={\"orientation\": \"horizontal\"})\n",
    "ax.set_aspect(\"equal\")\n",
    "plt.title('A')\n",
    "\n",
    "plt.sca(axs[3])\n",
    "plt.title('@')  # 绘制乘号\n",
    "plt.axis('off')\n",
    "\n",
    "plt.sca(axs[4])\n",
    "ax = sns.heatmap(B, cmap='RdYlBu_r', \n",
    "                 linecolor = 'k', linewidths = '0.25',\n",
    "                 xticklabels = [], yticklabels = [],\n",
    "                 cbar_kws={\"orientation\": \"horizontal\"})\n",
    "ax.set_aspect(\"equal\")\n",
    "plt.title('B')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a47dacd-9157-461b-89bb-7a3d558679fc",
   "metadata": {},
   "source": [
    "## 左右排列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "33879ad6-5f01-437e-af59-aaf51964b0bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(12, 8)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B_shape = B.shape\n",
    "B_shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c640b314-ac14-4aa8-b4ff-8178c809eb8c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n = B_shape[1]\n",
    "n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "290e8b0c-aff0-4904-95f6-b378cddfe755",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAH1CAYAAABmyk/MAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAm5UlEQVR4nO3df5BddX0//te5925CEpNAiEmNKZBA+MK3oBUlimLzo2MEp+NXOsZCv0odfvgNBjuRqTWVSijKBxUddBj4AEIZy4cvWJxWMlj8NFNDpNCMCHwBQcBiAw0JpoyQTBPyY+99f//Y3bibXSC4d8/Ze9+Px8ydvXv25r5fZ/eZc5577m5SpJRSAACQjVrVAwAAUC4FEAAgMwogAEBmFEAAgMwogAAAmVEAAQAyowACAGRGAQQAy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Ww3v/4wRms1YphOeypD89qrRbDcvibW23Q8S+G5fDA4+HgzA3O4UBGi4EM7s/coBwOZHDwcXHgmPkqWevL4YFf/IFjYTNicN76j1/Dcjjo/kAOW800LIet3kHHx0HHzQNzOFIGRzoentks71j4qufkEbI50jm5L0tDczjSObn2KufeA8/JA+fqIY8b4ZxcK2JYDkc6Jxf95+CRzs8D5+TB5+li2LFw0Dm51Rqew5HOya3W8ByOdE5upuE5HOGc3HeuHprDkc7JfZkbmsORzsmDM/dqx8I3ck52BRAAIDMKIABAZhRAAIDMKIAAAJlRAAEAcpPGyO7du9OaNWvS7t27x2qJcSGH/ezkfezk2d+IHPazk/exk2c/WDnsY0qdvZ+dPPvBso8Hr0gppbEoljt27Ijp06fH9u3bY9q0aWOxxLiQw3528j528uxvRA772cn72MmzH6wc9jGis/ezk2c/WPbx4HkJGAAgMwogAEBmFEAAgMyMWQGcOHFirFmzJiZOnDhWS4wLOexnJ+9jJ8/+RuSwn528j508+8HKYR8jOns/O3n2g2UfD96Y/RIIAADjk5eAAQAyowACAGRGAQQAyIwCCACQmVIK4KZNm+Lcc8+NefPmxaRJk+Loo4+ONWvWxN69e8tYfsxce+21MW/evDjkkEPine98Z9x7771Vj9RWV1xxRZx88skxderUmDVrVnzkIx+Jp556quqxfivdmsGI7s5hN2UwQg47lRx2hm7OYET7c1hKAXzyySej1WrF9ddfH48//nhcddVVcd1118UXvvCFMpYfE9/97ndj1apVcfHFF8fDDz8c73//++P000+P5557rurR2mbDhg2xcuXK2LhxY6xbty56e3tj2bJlsXPnzqpHe8O6MYMR3Z/DbspghBx2Kjkc/7o9gxFjkMM2/L/Ev5Wvfe1rad68eVUtP2oLFy5MK1asGLLtuOOOS6tXr65oorG3bdu2FBFpw4YNVY/SFp2ewZTyy2G3ZTAlOexEcjj+5JbBlEafw8p+BnD79u0xY8aMqpYflb1798aDDz4Yy5YtG7J92bJlcf/991c01djbvn17RETHft0O1MkZjMgzh92WwQg57ERyOL7kmMGI0eewkgL4zDPPxNVXXx0rVqyoYvlRe/HFF6PZbMbs2bOHbJ89e3a88MILFU01tlJKcdFFF8Wpp54aJ5xwQtXjjFqnZzAivxx2WwYj5LATyeH4k1sGI9qTw1EVwEsvvTSKonjN209/+tMhf2bLli1x2mmnxfLly+O8884bzfKVK4piyPsppWHbusWFF14Yjz76aNx2221VjzJE7hmMyCeH4zWDEXIYIYfjQe45zCWDEe3JYWO0A5x55pmv+Zijjjpq//0tW7bEkiVL4pRTTokbbrhhNEtXaubMmVGv14d9Z7Ft27Zh34F0g8985jOxdu3a+PGPfxxz586tepwhcs1gRF45HM8ZjJBDORwfcs1hThmMaGMO2/SziK9r8+bNacGCBenMM89Mvb29ZS07ZhYuXJguuOCCIduOP/74rvqB01arlVauXJnmzJmTnn766arHGbVuy2BK3Z/DbstgSnLYieRw/Ov2DKbU/hyWUgCff/75dMwxx6SlS5emzZs3p61bt+6/darbb7899fT0pJtuuik98cQTadWqVWnKlClp06ZNVY/WNhdccEGaPn16uueee4Z8zXbt2lX1aG9YN2Ywpe7PYTdlMCU57FRyOP51ewZTan8OSymAN998c4qIEW+d7JprrklHHnlkmjBhQjrppJO66p8ESCm96tfs5ptvrnq0N6xbM5hSd+ewmzKYkhx2KjnsDN2cwZTan8Oi/0kBAMiE/wsYACAzCiAAQGYUQACAzCiAAACZUQABADKjAAIAZEYBBADIjAIIAJAZBRAAIDMKIABAZhRAAIDMKIAAAJlRAAEAMqMAAgBkRgEEAMiMAggAkBkFEAAgMwogAEBmFEAAgMwogAAAmVEAAQAyowACAGRGAQQAyIwCCACQGQUQACAzCmCbLF68OIqiGHY77bTTqh6NzOzcuTMuueSSOPbYY2PixIlx+OGHx5IlS+IXv/hF1aORgU2bNo14LHRMpEx79uyJK6+8Mk444YSYMmVKzJ49O04//fS4//77qx5t3GhUPUA3mT9/ftx6661Dth166KHVDEOW/vu//zuWLFkSW7ZsidWrV8fb3va22L59e9x///2xa9euqscjA295y1vi3/7t34Zt//73vx9f/epX44wzzqhgKnJz/vnnx6233hp/9Vd/FUuXLo1f//rX8ZWvfCUWLVoU9913XyxcuLDqEStXpJRS1UN0g8WLF8eLL74YP/vZz6oehYytWrUqbrzxxnj00Udj/vz5VY8D+y1ZsiR+8pOfxNatW2PatGlVj0MX27NnT0yZMiXOOuusuOWWW/Zv37p1a8yZMyf+/M//PL71rW9VOOH44CXgfk8++WScddZZMXv27Jg4cWIcccQRcfbZZ8eePXuqHo2MjCaHu3btihtvvDGWL1+u/DEq7T4ePvPMM7Fhw4b42Mc+pvxxUEaTwVqtFrVaLaZPnz5k+7Rp06JWq8UhhxwyVmN3FAUwIh555JE4+eSTY+PGjXHZZZfF3XffHVdccUXs2bMn9u7de9DP88wzz8SMGTOi0WjE0UcfHRdffHG88sorYzg53WS0OXzwwQdj586dsWDBgrjgggvisMMOiwkTJsS73vWu+MEPflDCHtAN2nU8HOxv//ZvI6UU5513XpunpRuNNoM9PT3x6U9/Or7zne/E97///dixY0ds2rQpzj///Jg+fXqcf/75JezF+Ocl4Ij4wz/8w3jooYfi6aefjje/+c2/1XP89V//dbz1rW+N4447Ll555ZW4++6747rrrov3vve9sX79+qjVdG1e22hzePvtt8dZZ50V06ZNixNPPDE+//nPR61Wi2984xtxzz33xN133x0f/OAHx2Byukk7joeDNZvNOPLII2Pq1Knx85//vA0T0u3akcGUUlx66aXx5S9/OVqtVkREHHHEEXHnnXfG7//+77dx2g6WMrdz585Ur9fTpz71qbY/99e//vUUEekf/uEf2v7cdJd25PDWW29NEZFmzpyZduzYMeS558yZk973vve1Y1S62FgcD++6664UEenKK69s23PSvdqVwS996Utp8uTJ6bLLLkvr169Pd955Z/rABz6QZs6cmR566KE2TdvZsr8s9dJLL0Wz2Yy5c+e2/bk//vGPR0TExo0b2/7cdJd25PDwww+PiIj3vve9MXXq1P3bJ0+eHIsWLYqHHnpo1HPS3cbieHjTTTdFT09PnH322W17TrpXOzL485//PC655JL4m7/5m/jiF78Yixcvjg9/+MPxgx/8IA499NC46KKL2jhx58q+AM6YM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jhhRcqmmpspZTioosuilNPPTVOOOGEqscZtU7PYER+Oey2DEbIYSeSw/EntwxGtCeHoyqAl156aRRF8Zq3n/70p0P+zJYtW+K0006L5cuXx3nnnTea5StXFMWQ91NKw7Z1iwsvvDAeffTRuO2226oeZYjcMxiRTw7HawYj5DBCDseD3HOYSwYj2pPDxmgHOPPMM1/zMUcdddT++1u2bIklS5bEKaecEjfccMNolq7UzJkzo16vD/vOYtu2bcO+A+kGn/nMZ2Lt2rXx4x//OObOnVv1OEPkmsGIvHI4njMYIYdyOD7kmsOcMhjRxhy26WcRX9fmzZvTggUL0plnnpl6e3vLWnbMLFy4MF1wwQVDth1//PFd9QOnrVYrrVy5Ms2ZMyc9/fTTVY8zat2WwZS6P4fdlsGU5LATyeH41+0ZTKn9OSylAD7//PPpmGOOSUuXLk2bN29OW7du3X/rVLfffnvq6elJN910U3riiSfSqlWr0pQpU9KmTZuqHq1tLrjggjR9+vR0zz33DPma7dq1q+rR3rBuzGBK3Z/DbspgSnLYqeRw/Ov2DKbU/hyWUgBvvvnmFBEj3jrZNddck4488sg0YcKEdNJJJ3XVPwmQUnrVr9nNN99c9WhvWLdmMKXuzmE3ZTAlOexUctgZujmDKbU/h0X/kwIAkAn/FzAAQGYUQACAzCiAAACZUQABADKjAAIAZEYBBADIjAIIAJAZBRAAIDMKIABAZhRAAIDMKIAAAJlRAAEAMvP/A6gf/qRU3R7LAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 800x600 with 16 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, axs = plt.subplots(2, 4, figsize=(8, 6))  \n",
    "axs = axs.flatten()\n",
    "\n",
    "for j in range(n):\n",
    "    C_j = A @ B [:,[j]]\n",
    "\n",
    "    plt.sca(axs[j])\n",
    "    ax = sns.heatmap(C_j, cmap='RdYlBu_r', \n",
    "                     linecolor = 'k', linewidths = '0.25',\n",
    "                     vmin = C.min(), vmax = C.max(),\n",
    "                     xticklabels = [], yticklabels = [],\n",
    "                     cbar_kws={\"orientation\": \"horizontal\"})\n",
    "    ax.set_aspect(\"equal\")\n",
    "    plt.title('c_' + str(j + 1))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5468f61f-4827-4b22-8753-33710c28a29f",
   "metadata": {},
   "source": [
    "作者\t**生姜DrGinger**  \n",
    "脚本\t**生姜DrGinger**  \n",
    "视频\t**崔崔CuiCui**  \n",
    "开源资源\t[**GitHub**](https://github.com/Visualize-ML)  \n",
    "平台\t[**油管**](https://www.youtube.com/@DrGinger_Jiang)\t\t\n",
    "\t\t[**iris小课堂**](https://space.bilibili.com/3546865719052873)\t\t\n",
    "\t\t[**生姜DrGinger**](https://space.bilibili.com/513194466)  "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:base] *",
   "language": "python",
   "name": "conda-base-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
